home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / tcclib.exe / STRREPLC.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-31  |  476 b   |  22 lines

  1. #include <string.h>
  2. #include <alloc.h>
  3.  
  4. char *strreplace (char *string, int start, int num, char *repstr )
  5. {
  6.     int x = 0;
  7.     char *success;
  8.  
  9.     --start;
  10.     /* "start" becomes zero relative */
  11.     if ( start < strlen (string) ) {
  12.         while ( string[start] != '\0' && *repstr != '\0' && x < num )
  13.             { string[start++] = *repstr;  ++repstr; x++; }
  14.         success = string;
  15.     }
  16.     else
  17.         success = NULL;
  18.  
  19.     return (success);
  20. }
  21.  
  22.